from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from db_base import Base
from db_base import Oplogs
from db_base import Users


class DB():
    def __init__(self):
        self.engine = create_engine("mysql+mysqlconnector://wkx:iroanMY147@localhost/demo_user_web", echo=True)
        self.db_session = sessionmaker(bind=self.engine)
        self.create_info = Base.metadata.create_all(self.engine)
        self.session = self.db_session()

    def _insert(self, record):
        self.session.add(record)
        self.session.commit()
        self.session.close()
